home *** CD-ROM | disk | FTP | other *** search
/ Die Speccy' 97 / Die Speccy' 97.iso / amiga_system / the_aminet / comm / tcp / newsed_fix.lha / Postnews < prev    next >
Text File  |  1980-01-01  |  3KB  |  149 lines

  1. /*
  2. ** Postnews Replacement Script
  3. ** GRn Can Now Post News :-)
  4. */
  5. Parse arg result
  6. say result
  7. a = 1
  8. art = word(result,1)
  9. say art
  10. art2 = word(result,3)
  11. alreadyinsertedfile = "FALSE"
  12. org = "The Martin Hunt Fan Club"
  13. if open(org,"env:organization","R") then
  14. do
  15.    organisation = readln(org)
  16.    call close(org)
  17. end
  18.  
  19. if open(org,"env:user","R") then
  20. do
  21.    user = readln(org)
  22.    call close(org)
  23. end
  24. if open(hos,"env:host","R") then
  25. do
  26.    host = readln(hos)
  27.    call close(hos)
  28. end
  29. if open(rln,"env:realname","R") then
  30. do
  31.    realname = readln(rln)
  32.    call close(rln)
  33. end
  34.  
  35. if art2 = "" then
  36. do
  37.   call open(file,art,"A")
  38.   call seek(file,0,"B")
  39.   a = 1
  40.   newsgroup = readln(file)
  41.   line.1 = newsgroup
  42.   a = 3
  43.   line.3 = "Organization: "||organisation
  44.   line.2 = "From: "||user||"@"||host||" ("||realname||")"
  45.   do until eof(file)
  46.     a = a + 1
  47.     line.a = readln(file)
  48.     if compress(line.a) == "--" then
  49.     do
  50.       call signature()
  51.       lev = 1
  52.     end
  53.     if lev = 1 then leave
  54.   end
  55.   call close(file)
  56.   call open(file,art,"W")
  57.   call seek(file,0,"B")
  58.   do i = 1 to a
  59.      call writeln(file,line.i)
  60.   end
  61.   call close(file)
  62. end
  63. if art2 ~="" then
  64. do
  65.   call open(file,art,"A")
  66.   call seek(file,0,"B")
  67.   newsgroup = readln(file)
  68.   line.1 = newsgroup
  69.   a = 2
  70.   sig = 0
  71.   do while ~eof(file) & ~Sig
  72.     a = a + 1
  73.     if alreadyinsertedfile == "FALSE" then call insertfile2()
  74.     line.a = readln(file)
  75.     say line.a
  76.     if compress(line.a) == "--" then call signature()
  77.     if upper(word(line.a,1)) == "FROM:" then a = a - 1
  78.   end
  79.   call close(file)
  80.   n = 1
  81.   quitflag = 0
  82.   do until quitflag
  83.      filename = "t:grn-file."||n
  84.      if ~exists(filename) then quitflag = 1
  85.      n = n + 1
  86.   end
  87.   art = filename
  88.   call open(file,art,"W")
  89.   call seek(file,0,"B")
  90.   line.2 = "Organization: "||organisation
  91.   line.3 = "From: "||user||"@"||host||" ("||realname||")"
  92.   do i = 1 to a
  93.      call writeln(file,line.i)
  94.   end
  95.   call close(file)
  96. end
  97.  
  98. newsno = 0
  99. result1 = open(batchnews,"uuspool:newsno","A")
  100. if ~result1 then result2 = open(batchnews,"uuspool:newsno","W")
  101. call seek(batchnews,0,"B")
  102. if result1 then newsno=readln(batchnews)
  103. newsno = newsno + 1
  104. call seek(batchnews,0,"B")
  105. call writeln(batchnews,newsno)
  106. call close(batchnews)
  107.  
  108. newnewsfile = "uuspool:news."||newsno
  109. copycmd = "copy "||art||" to "||newnewsfile
  110. address command copycmd
  111. result1 = open(batchnews,"uuspool:newsout","A")
  112. if ~result1 then open(batchnews,"uuspool:newsout","W")
  113. call seek(batchnews,0,"E")
  114. call writeln(batchnews,newnewsfile)
  115. call close(batchnews)
  116.  
  117. exit
  118.  
  119. insertfile2:
  120.   call open(file2,art2,"R")
  121.   do while ~eof(file2)
  122.     a = a + 1
  123.     line.a = readln(file2)
  124.     if word(line.a,1) == "X-NewsSoftware:" then line.a = "X-NewsSoftware: GRn 2.1 19/2/94 (PostNews Fix 31/3/95 Martin Hunt)"
  125.   end
  126.   alreadyinsertedfile = "TRUE"
  127.   call close(file2)
  128. RETURN
  129.  
  130. Signature:
  131. parse var newsgroup title ": " name.1 "." name.2 "." name.3 "." name.4 "." name.5 "." name.6 "." name.7 "." name.8 "." name.9 "." name.10
  132. nameno = 1
  133. sigfile = "uunews:"
  134. do while name.nameno ~== ""
  135.   sigfile = sigfile || name.nameno ||"/"
  136.   nameno = nameno + 1
  137. end
  138. sigfile = sigfile ||".sig"
  139. if open(sig,sigfile,"R") then
  140. do
  141.   do until eof(sig)
  142.     a = a + 1
  143.     line.a = readln(sig)
  144.   end
  145.   call close(sig)
  146.   sig = 1
  147. end
  148. return
  149.